## Process this file with automake to produce Makefile.in

EXTRA_PROGRAMS = shacrypt-gui
EXTRA_DIST = third-party shacrypt.glade glade.sed

include_HEADERS = shacrypt.h

lib_LIBRARIES = libshacrypt.a
libshacrypt_a_SOURCES = shacrypt.h shacrypt.c third-party/sha1.c third-party/sha2.c third-party/md5c.c third-party/cubehash.c third-party/whirlpool.c third-party/mt19937ar.h
libshacrypt_a_CFLAGS = $(DWINDOWS) $(AM_CFLAGS)

bin_PROGRAMS = shacrypt
shacrypt_SOURCES = commandline.c shacrypt.h
shacrypt_LDADD = libshacrypt.a
shacrypt_CFLAGS = $(DWINDOWS) $(AM_CFLAGS)

if WANT_GUI
bin_PROGRAMS += shacrypt-gui$(EXEEXT)
endif

BUILT_SOURCES = glade.h
CLEANFILES = glade.h

glade.h: shacrypt.glade glade.sed Makefile
	$(SED) -f $(srcdir)/glade.sed -e 's/[@]VERSION[@]/$(VERSION)/g' -e 's,[@]URL[@],$(PACKAGE_URL),g' \
		< $(srcdir)/shacrypt.glade > glade.h

shacrypt-gui.rc: shacrypt-gui.rc.in Makefile
	$(SED) -e 's/[@]VERSION[@]/$(VERSION)/g' -e 's/[@]COMMAVERSION[@]/$(COMMAVERSION)/' \
		-e 's:[@]DATADIR[@]:$(top_srcdir)/data:g' < $(srcdir)/shacrypt-gui.rc.in > shacrypt-gui.rc

SUFFIXES = .rc
.rc.o:
	@WINDRES_EXE@ $^ $@

shacrypt_gui_SOURCES = gui.c shacrypt.h shacrypt-icon.h
nodist_EXTRA_shacrypt_gui_SOURCES = shacrypt-gui.rc
nodist_shacrypt_gui_SOURCES = glade.h

if WITH_WINDOWS
nodist_shacrypt_gui_SOURCES += shacrypt-gui.rc
endif

shacrypt_gui_LDADD = libshacrypt.a $(GUI_LIBS)
shacrypt_gui_CFLAGS = $(GUI_CFLAGS) $(MWINDOWS) $(AM_CFLAGS)